using System;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Cadastros_CustoBrowser : Page
{
    #region Load

    protected void Page_Load(object sender, EventArgs e)
    {
    }

    #endregion

    #region methods

    protected void dsCusto_Inserting(object sender, SqlDataSourceCommandEventArgs e)
    {
        var cbCentroCusto = (DropDownList) dtlMain.FindControl("cbCentroCusto");
        e.Command.Parameters[1].Value = cbCentroCusto.SelectedItem.Value;
    }

    protected void dsCusto_Updating(object sender, SqlDataSourceCommandEventArgs e)
    {
        var cbCentroCusto = (DropDownList) grdMain.Rows[grdMain.EditIndex].FindControl("cbCentroCusto");
        e.Command.Parameters[0].Value = cbCentroCusto.SelectedItem.Value;
    }

    #endregion
}